package com.hontech.desktoppastacooker.codec

import com.hontech.desktoppastacooker.utils.toUint8


fun decodeUint8(buf: ByteArray, offset: Int): Int {
    return buf[offset].toUint8()
}

fun decodeUint16(buf: ByteArray, offset: Int): Int {
    return (buf[offset].toUint8() shl 8) +
            buf[offset + 1].toUint8()
}

fun decodeUint32(buf: ByteArray, offset: Int): Int {
    return (buf[offset].toUint8() shl 24) +
            (buf[offset + 1].toUint8() shl 16) +
            (buf[offset + 2].toUint8() shl 8) +
            buf[offset + 3].toUint8()
}




